<?php defined( '_JEXEC' ) or die( 'Restricted access' ); jimport( 'joomla.methods' );?>
<h1>Hizkuntza Kudeaketa/Translation Management: <?php if($this->lang->getName() != "") echo($this->lang->getName()); else  echo JText::_('LANG_'.strtoupper($this->lang->getId()));?></h1>
<br/>
<a id="backButton" style="float:right;" href="index.php?option=com_hizkimizki&task=adminHizkimizki" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button">
	<span class="ui-button-text">Itzuli/Back</span>
</a>
<form action="" method="post" id="editLangForm">
	<input type="hidden" id="code" name="code" value="<?php echo($this->code);?>">
	<label>Erreferentzia/Reference: </label>
	<select id="refLang" name="refLang" onchange="submit();" style="width: 200px; text-align: center;">
		<option value=""> - </option>
		<?php foreach($this->languages as $language): 
			if ($language->getId() == $this->refLang){
		?>
			<option selected="selected" value="<?php echo $language->getId(); ?>"><?php echo JText::_('LANG_'.strtoupper($language->getId()));?></option>
		<?php 
			}else{
		?>
			<option value="<?php echo $language->getId(); ?>"><?php echo JText::_('LANG_'.strtoupper($language->getId()));?></option>
		<?php
			}
		endforeach; ?>
	</select>
</form>
<br/>
<?php
	if($this->refLang != null){
		if(strlen($this->lang->getActive()) > 1){

?>
	<a id="activeButton" href="index.php?option=com_hizkimizki&task=stateTranslation&act=accept&code=<?php echo($this->lang->getId());?>" onclick="if(confirm('Zihur itzulpena onartu eta aktibatu nahi duzula?'))return true; else return false;" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button">
		<span class="ui-button-text">Onartu eta aktibatu Itzulpena/Accept and ActiveTranslation</span>
	</a>
<?php }else if($this->lang->getActive()){
	?>
	<a href="index.php?option=com_hizkimizki&task=stateTranslation&act=inactive&code=<?php echo($this->lang->getId());?>" onclick="if(confirm('Zihur itzulpena ezgaitu nahi duzula?'))return true; else return false;" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button">
		<span class="ui-button-text">Itzulpena Ezgaitu/Inactive Translation</span>
	</a>
	<?php
}else if(!$this->lang->getActive()){
	?>
	<a href="index.php?option=com_hizkimizki&task=stateTranslation&act=active&code=<?php echo($this->lang->getId());?>" onclick="if(confirm('Zihur itzulpena aktibatu nahi duzula?'))return true; else return false;" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button">
		<span class="ui-button-text">Itzulpena gaitu/Active Translation</span>
	</a>
	<?php
}?>
<br/>
<hr/>
<br/>
<p onclick="enableEditForm();" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button">
	<span class="ui-button-text">Editatu</span>
</p>
<form action="" method="post" id="transForm">
	<input type="hidden" id="type" name="type" value="<?php echo($this->type);?>">
	<input type="hidden" id="lang" name="lang" value="<?php echo($this->lang->getId());?>">
	<input type="hidden" id="option" name="option" value="com_hizkimizki"/>
	<input type="hidden" id="reflang" name="reflang" value="<?php echo $this->refLang; ?>">
	<input type="hidden" id="task" name="task" value="manageTranslation" />
	<fieldset>
		<div class="row">
			<div class="col-left">
				<label style="margin-left: 5px;">Egilea/Author: </label>
				<input class="editTransInput" disabled="disabled" type="text" id="name" name="name" value="<?php echo($this->lang->getAuthor()); ?>"/>
			</div>
			<div class="col-right">
				<label>Email: </label><input disabled="disabled" type="email" id="email" name="email" class="editTransInput" value="<?php echo($this->lang->getEmail());?>"/>
			</div>
		</div>
		<div class= "row">
			<?php
			if($this->lang->getName() != ""){
				?>
			<div class="col-left">
				<label style="margin-left: 5px;">Hizkuntza Izena/Language Name:</label>
				<input class="editTransInput" disabled="disabled" type="text" id="language" name="language" value="<?php echo($this->lang->getName());?>" />
			</div>
			<?php
			}	
			?>
			<div class="col-right">
				<label>Hizkuntza/Language ISO-Code:</label>
				<input class="editTransInput" disabled="disabled" style="float:right;" type="text" id="iso" name="iso" size="5" maxlength="5" value="<?php echo($this->lang->getId());?>">
			</div>
		</div>
	</fieldset>
	<?php
		$side = true;

		foreach($this->refwords as $i => $word):
				if ($side) {
					$side = false;
				?>
					<div class='row'>
						<div class='col-left'>
							<label><?php echo $word->_word ?></label>: <input type='text' id='word_$word->_wordNum' name='word_$word->_wordNum' value="<?php echo($this->words[$word->_wordNum -1]->getWord())?>" disabled='disabled' class='editTransInput'/>
						</div>
				<?php
				}
				else {
					$side = true;
				?>
						<div class='col-right'>
							<label><?php echo $word->_word ?></label>: <input type='text' id='word_$word->_wordNum' name='word_$word->_wordNum' value="<?php echo($this->words[$word->_wordNum -1]->getWord())?>" disabled='disabled' class='editTransInput'/>
						</div>
					</div>
				<?php
				}
		endforeach;
		if (!$side) {
			echo "</div>";
		}
		?>
	<hr/>
	<center>
		<input id="updateButton" class="editTransInput" type="button" disabled="disabled" value="Eguneratu/Update!">
	</center>
</form>
<?php } ?>
<br/>